package com.emergency.examine.dao;


import com.emergency.examine.domain.ExamAnswer;
import com.emergency.examine.domain.ExamScore;
import com.emergency.examine.domain.Option;
import com.emergency.examine.domain.PaperQuestion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


//考生答案dao
public interface ExamAnswerDao extends JpaRepository<ExamAnswer, Long>, JpaSpecificationExecutor<ExamAnswer> {
    @Query("select ea from ExamAnswer ea where exam.id = :examId")
    List<ExamAnswer> findAllByExam(Long examId);

    @Modifying
    @Transactional
    @Query(value = "delete FROM ex_exam_answer WHERE exam_id = ? ", nativeQuery = true)
    void deleteByExamId(Long examId);
}
